package lhdmn;
// 菜品父类
class Dish {
    private String name;    // 菜品名称
    private double price;   // 价格
    private int stock;      // 库存
    private boolean isOnSale; // 是否上架

    public Dish(String name, double price, int stock, boolean isOnSale) {
        this.name = name;
        this.price = price;
        this.stock = stock;
        this.isOnSale = isOnSale;
    }

    // Getter和Setter方法
    public String getName() { return name; }
    public double getPrice() { return price; }
    public int getStock() { return stock; }
    public boolean isOnSale() { return isOnSale; }
    public void setStock(int stock) { this.stock = stock; }
    public void setOnSale(boolean onSale) { isOnSale = onSale; }
}

// 主食子类
class MainDish extends Dish {
    private String category; // 主食类别（如米饭、面食）

    public MainDish(String name, double price, int stock, boolean isOnSale, String category) {
        super(name, price, stock, isOnSale);
        this.category = category;
    }

    public String getCategory() { return category; }
}

// 饮料子类
class Drink extends Dish {
    private boolean isCarbonated; // 是否含气

    public Drink(String name, double price, int stock, boolean isOnSale, boolean isCarbonated) {
        super(name, price, stock, isOnSale);
        this.isCarbonated = isCarbonated;
    }

    public boolean isCarbonated() { return isCarbonated; }
}